package com.guangfeng.yql.comm.netty.util;

import cn.hutool.json.JSONUtil;
import com.guangfeng.yql.comm.netty.constant.Constant;
import lombok.Builder;
import lombok.Data;

import java.io.Serializable;

@Builder
@Data
public class NettyResponseBeanUtil implements Serializable {
    private Integer code;
    private Integer status;
    private String message;
    private String imagesUrl;
    private String name;

    public static String parameterError(String message) {
        return JSONUtil.toJsonStr(NettyResponseBeanUtil.builder()
                .status(Constant.RESPONSE_PARAMETER_ERROR_STATUS).message(message).code(Constant.RESPONSE_TEXT_CODE)
                .build());
    }

    public static String text(String message, String name) {
        return JSONUtil.toJsonStr(NettyResponseBeanUtil.builder()
                .status(Constant.RESPONSE_SUCCESS_STATUS).message(message).code(Constant.RESPONSE_TEXT_CODE).name(name)
                .build());
    }
    public static String images(String images, String name) {
        return JSONUtil.toJsonStr(NettyResponseBeanUtil.builder()
                .status(Constant.RESPONSE_SUCCESS_STATUS).imagesUrl(images).code(Constant.RESPONSE_IMAGES_CODE).name(name)
                .build());
    }

}
